package com.example.data;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.Reader;
import com.ibatis.common.resources.Resources;
import com.ibatis.sqlmap.client.SqlMapClient;
import com.ibatis.sqlmap.client.SqlMapClientBuilder;

public class ConnectionFactory {
	private static SqlMapClient sqlMapClient;

	static {
		try {
			Reader reader = Resources.getResourceAsReader("SqlMapconfig.xml");
			if (sqlMapClient == null) {
				sqlMapClient = SqlMapClientBuilder.buildSqlMapClient(reader);
			}
		} catch (FileNotFoundException e) {
			e.printStackTrace();
			// TODO: handle exception
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	public static SqlMapClient getSqlMapClient() {
		return sqlMapClient;
	}

}
